/*
 * IO.cpp
 * unused right now, destined to be something for switching between Serial and Ethernet inputs/outputs
 *
 *  Created on: 6 mars 2012
 *      Author: Jeff
 */

#include <Arduino.h>
#include "config.h"
#include "IO.h"

// function to print a PROGMEM string
void printPGM(const prog_uchar * str) {
	char c;
	while((c = pgm_read_byte(str++)))
		OUTPUT_PRINT(c);
}


boolean testStrings(const char * a, const prog_uchar * b) {
	char inChar;
	for (int i=0; ; i++) {
		inChar = pgm_read_byte(&b[i]);
		if ((inChar == '\0') || (a[i] == '\0'))
			return(true);
		if (inChar == '\0')
			return(false);
		if (a[i] == '\0')
			return(false);
		if (inChar != a[i])
			return(false);
	}
}
#ifdef BIDULE
class ShellInput {
public:
	void init();
	void available(char * str);
	char read(char * str);
};

class ShellOutput {
public:
	void init();
	void print(char * str);
	void println(char * str);
};

class ShellOutputSerial:ShellOutput {
public:
	void init() {
		Serial.begin(9600);
	}
	void print(char * str) {
		Serial.print(str);
	}
	void println(char * str) {
		Serial.println(str);
	}
};
#endif
